<style>
    ins{
        text-align: center;
    }
</style>


<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__("Subject_id")}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-subject_id" data-rule="required" data-field="subject_name" data-source="kaoshi/subject/index" class="form-control selectpage" name="row[subject_id]" type="text" value="">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__("Question")}:</label>
        <div class="col-xs-12 col-sm-8">
            <textarea id="c-question" data-rule="required" class="form-control " rows="5" name="row[question]" cols="50"></textarea>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__("Type")}:</label>
        <div class="col-xs-12 col-sm-8">

            <select  id="c-type" data-rule="required" class="form-control selectpicker" name="row[type]">
                {foreach name="typeList" item="vo"}
                <option value="{$key}" {in name="key" value="1"}selected{/in}>{$vo}</option>
                {/foreach}
            </select>

        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__("Select")}:</label>
        <div class="col-xs-12 col-sm-8">



            {foreach  name="selectdata" item="type"  key="k" }
            <dl    data-template="answer{$k}" class="fieldlist fieldlist{$k} {$k!=0? 'hidden' : ''}" data-name="row[selectdata{$k}]" data-listidx="0">
                 <dd><ins>选项</ins><ins>答案</ins><ins>正确答案</ins></dd>
                {if condition="$k eq '2'"}
                {foreach  name="type" item="option"  key="j" }
                <dd class="form-inline">
                    <ins><input type="text" name="row[selectdata{$k}][{$j}][key]" class="form-control" placeholder="选项" size="10" value="{$option['key']}"  {$k==2? 'readonly' : ''}/></ins>
                    <ins><input type="text" name="row[selectdata{$k}][{$j}][value]" class="form-control" placeholder="" value="{$option['value']}"  {$k==2? 'readonly' : ''}/></ins>

                    <ins><input type="radio" name="row[answer{$k}]" value="{$option['key']}"  /></ins>
                    <!--下面的两个按钮务必保留-->
                    {if condition="$k neq '2'"}
                    <span class="btn btn-sm btn-danger btn-remove"><i class="fa fa-times"></i></span>
                    <span class="btn btn-sm btn-primary btn-dragsort"><i class="fa fa-arrows"></i></span>

                    {/if}
                </dd>
                {/foreach}
                {/if}

                {if condition="$k neq '2'"}

                <dd><a href="javascript:;" class="btn btn-sm btn-success btn-append"><i class="fa fa-plus"></i> 追加</a></dd>
                {/if}
                <textarea name="row[selectdata{$k}]" class="form-control hide" cols="30" rows="5">{:json_encode($type)}</textarea>
            </dl>
            {/foreach}






            <!--单选题 -->
            <script id="answer0" type="text/html">

                <dd class="form-inline">
                    <ins><input type="text" name="<%=name%>[<%=index%>][key]" class="form-control" placeholder="选项" size="10" value="<%=row.key%>"/></ins>
                    <ins><input type="text" name="<%=name%>[<%=index%>][value]" class="form-control" placeholder="" value="<%=row.value%>"/></ins>
                    <ins><input type="radio" name="row[answer0]" value="<%=row.key%>"/></ins>
                    <!--下面的两个按钮务必保留-->
                    <span class="btn btn-sm btn-danger btn-remove"><i class="fa fa-times"></i></span>
                    <span class="btn btn-sm btn-primary btn-dragsort"><i class="fa fa-arrows"></i></span>
                </dd>
            </script>

            <!--多选题 -->
            <script id="answer1" type="text/html">

                <dd class="form-inline">
                    <ins><input type="text" name="<%=name%>[<%=index%>][key]" class="form-control" placeholder="选项" size="10"  value="<%=row.key%>"/></ins>
                    <ins><input type="text" name="<%=name%>[<%=index%>][value]" class="form-control" placeholder=""  value="<%=row.value%>"/></ins>
                    <ins><input type="checkbox" name="row[answer1][]" value="<%=row.key%>" /></ins>
                    <!--下面的两个按钮务必保留-->
                    <span class="btn btn-sm btn-danger btn-remove"><i class="fa fa-times"></i></span>
                    <span class="btn btn-sm btn-primary btn-dragsort"><i class="fa fa-arrows"></i></span>
                </dd>
            </script>
            <div style="color:red;">*请选中正确答案</div>


        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__("Describe")}:</label>
        <div class="col-xs-12 col-sm-8">
            <textarea id="c-describe"  class="form-control " rows="5" name="row[describe]" cols="50"></textarea>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__("Level")}:</label>
        <div class="col-xs-12 col-sm-8">

            <select  id="c-level" data-rule="required" class="form-control selectpicker" name="row[level]">
                {foreach name="levelList" item="vo"}
                <option value="{$key}" {in name="key" value="1"}selected{/in}>{$vo}</option>
                {/foreach}
            </select>

        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__("Status")}:</label>
        <div class="col-xs-12 col-sm-8">
            <select  id="c-status" data-rule="required" class="form-control selectpicker" name="row[status]">


                {foreach name="statusList" item="vo"}
                <option value="{$key}" {in name="key" value="1"}selected{/in}>{$vo}</option>
                {/foreach}
            </select>
        </div>
    </div>
    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-success btn-embossed disabled">{:__("OK")}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__("Reset")}</button>
        </div>
    </div>
</form>
